From: Colin Walters Date: Sat, 3 Jan 2015 17:14:11 +0000 (-0500) Subject: deploy: Actually copy xattrs of modified config files X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~1006 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=01f6d68c6029a797053a709adb302973ccf1aba6;p=ostree.git deploy: Actually copy xattrs of modified config files Regression from 7b01bd2e4333d4346dd08e0b5caf672f56b1ccfd where we stopped using g_file_copy() - we lost copying xattrs. This specifically breaks /etc/shadow SELinux labeling, with the obvious bad consequences. https://bugzilla.gnome.org/show_bug.cgi?id=742289 --- diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index 70e4bd39..669604e4 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -93,6 +93,13 @@ copy_one_file_fsync_at (int src_parent_dfd, } out = g_unix_output_stream_new (dest_fd, TRUE); + if (src_xattrs != NULL) + { + if (!gs_fd_set_all_xattrs (dest_fd, src_xattrs, + cancellable, error)) + goto out; + } + if (g_output_stream_splice (out, in, 0, cancellable, error) < 0) goto out; @@ -134,6 +141,12 @@ copy_one_file_fsync_at (int src_parent_dfd, gs_set_error_from_errno (error, errno); goto out; } + if (src_xattrs != NULL) + { + if (!gs_dfd_and_name_set_all_xattrs (dest_parent_dfd, name, src_xattrs, + cancellable, error)) + goto out; + } if (fchownat (dest_parent_dfd, name, stbuf->st_uid, stbuf->st_gid, AT_SYMLINK_NOFOLLOW) != 0)